from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime, Float, Date, Time
from sqlalchemy.orm import relationship, backref

Base = declarative_base()

__all__ = ['{{ class_name }}']

class {{ class_name }}(Base):
    __tablename__ = '{{ table_name }}'

    id = Column(Integer, primary_key=True)
    
    # python string
    string_col = Column(String)
    
    # python float
    float_col = Column(Float)
    
    # datetime.datetime() objects
    datetime_col = Column(DateTime)

    # datetime.date() objects
    date_col = Column(Date)

    # datetime.time() objects
    time_col = Column(Time)
    
    foreign_id = Column(Integer, ForeignKey('foreign_table.id'))
    
    foreign_obj = relationship("ForeignModelClassName", backref=backref('{{ table_name }}', orderby=id))

    def __init__(self, string_col, float_col, foreign_id):
        self.string_col = string_col
        self.float_col = float_col
        self.foreign_id = foreign_id
        self.datetime_col = datetime.now()
        self.date_col = self.datetime_col.date()
        self.time_col = self.datetime_col.time()

    def __repr__(self):
       return "<{{ class_name }}('%s','%s', '%s')>" % (self.string_col, self.float_col, self.foreign_id, self.datetime_col, self.date_col, self.time_col)

